﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.CrystalReports.Engine; 
using CrystalDecisions.Shared;
using ATSModel.T_ReportInfo;
using System.Collections.Generic;
using ATSBLL;
using ATSModel;

public partial class TestDataReport_BatchDataReport_TestPeports : System.Web.UI.Page
{ 
    string Mo = ""; 
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
    protected void MOSerach_Click(object sender, EventArgs e)
    {

         Mo = this.ProMO1.Text.Trim();
         CrystalReportViewer.DisplayToolbar = true;

         CrystalReportSource.ReportDocument.Load(Server.MapPath("TestByInfoCrystalReport.rpt"));
         if (string.IsNullOrEmpty(Mo))
         {
             ScriptManager.RegisterStartupScript(this.UpdatePanel1,
                      this.GetType(), "click", "<script>alert('" + "请输入MO号！" + "');</script>", false);
             return;
         }

         IList<TRPeportInfo> list = Data_ByMOS(Mo); 
         this.CrystalReportSource.ReportDocument.SetDataSource(list);
         this.CrystalReportSource.DataBind();
         this.CrystalReportViewer.ReportSource = CrystalReportSource; 
         this.CrystalReportViewer.DataBind();
         this.CrystalReportViewer.Visible = true;

    }

    protected IList<TRPeportInfo> Data_ByMOS(string Mo)
    {
        IList<TRPeportInfo> testItems = new List<TRPeportInfo>();
        TPT_Report elect = new TPT_Report();
        testItems = elect.PIMData_ByMOS(Mo);
        return testItems;
    }
  
}
